package com.company.app.service;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.xml.ws.WebServiceException;

import com.company.app.entities.Product;

@Path("/ProductService")
@WebService
public interface ProductService {

	/**
	 * Gets the product by id.
	 *
	 * @param id the id
	 * @return the product by id
	 */
	@GET
	@Produces({"application/json", "application/xml"})
	@Path("/{id}")
	@WebMethod(operationName="gestProductByID")
	public @WebResult(name="Product", targetNamespace="http://entities.app.company.com") Product getProductById(@WebParam(name="id") @PathParam ("id") Long id) throws WebServiceException;
	
	/**
	 * Search Product by filter.
	 *
	 * @return the Product
	 */
	@GET
	@Produces({"application/json", "application/xml"})	
	@Path("/searchProductByFilter")
	@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
	@WebMethod(operationName="searchProductByFilter")
	public @WebResult(name="ProductList", targetNamespace="http://List.util.java") List<Product> searchProductByFilter(@WebParam(name="ProductFilter") @QueryParam("") Product product) throws WebServiceException;
	
	
	@GET
	@Produces({"application/json", "application/xml"})	
	@Path("/getAllProducts")
	@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
	@WebMethod(operationName="getAllProducts")
	public @WebResult(name="ProductList", targetNamespace="http://List.util.java") List<Product> getAllProducts() throws WebServiceException;
	
	/**
	 * Execute Product bussiness logic.
	 *
	 * @return true, if successful
	 */
	@WebMethod(operationName="executeProductBussinessLogic")
	public boolean executeProductBussinessLogic();
	
	/**
	 * Creates the Product.
	 *
	 * @param Product the Product
	 * @return true, if successful
	 */
	@POST	
	@Produces("text/plain")	
	@Path("/createProduct")
	@WebMethod(operationName="createProduct")
	public @WebResult(name="success") boolean createProduct(@WebParam(name="ProductEntity") @QueryParam("") Product product) throws WebServiceException;
	
	/**
	 * Update Product.
	 *
	 * @param Product the Product
	 * @return true, if successful
	 */
	@PUT
	@Produces("text/plain")	
	@Path("/updateProduct")
	@WebMethod(operationName="updateProduct")
	public @WebResult(name="success") boolean updateProduct(@WebParam(name="updateEntity") @QueryParam("") Product product) throws WebServiceException;
	
	/**
	 * Delete Product.
	 *
	 * @param Product the Product
	 * @return true, if successful
	 */
	@DELETE
	@Produces("text/plain")	
	@Path("/deleteProduct")
	@WebMethod(operationName="deleteProduct")
	public @WebResult(name="success") boolean deleteProduct(@WebParam(name="deleteEntity") @QueryParam("") Product product) throws WebServiceException;
	
	
	/**
	 * Creates the tmp product.
	 *
	 * @return the product
	 * @throws WebServiceException the web service exception
	 */
	@POST
	@Produces({"application/json", "application/xml"})	
	@Path("/createTmpObject")
	@WebMethod(operationName="createTmpObject")
	public @WebResult(name="Product") Product createTmpProduct() throws WebServiceException;

}
